package com.zmt.content.api;

import com.zmt.content.po.CourseTeacher;
import com.zmt.content.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value = "教师编辑接口",tags = "教师编辑接口")
@RestController
public class CourseTeacherController {

    @Autowired
    private CourseTeacherService courseTeacherService;

    @ApiOperation("教师管理接口")
    @GetMapping("courseTeacher/list/{courseId}")
    public List<CourseTeacher> listCourseTeacher(@PathVariable Long courseId){
        List<CourseTeacher> result = courseTeacherService.listCourseTeacher(courseId);
        return result;
    }

    @ApiOperation("添加或修改教师接口")
    @PostMapping("/courseTeacher")
    public CourseTeacher createCourseTeacher(@RequestBody CourseTeacher courseTeacher){
        CourseTeacher result=courseTeacherService.createCourseTeacher(courseTeacher);
        return result;
    }

    @ApiOperation("删除教师接口")
    @DeleteMapping("/courseTeacher/course/{courseId}/{id}")
    public void deleteCourseTeacher(@PathVariable Long courseId,@PathVariable Long id){
        courseTeacherService.deleteCourseTeacher(courseId,id);
    }

}
